<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = new Array(10);
        while(arr.length < 10){
            var num = Math.floor(Math.random * (29 - 20 + 1) + 20);
            if(arr.indexOf(num) == -1){
                arr.push(num);
            }
            i++;
        }
        document.write(arr);
        
    </script>
</body>

</html>